package com.tianshi.yingxue.controller;


import com.tianshi.yingxue.entity.Admin;
import com.tianshi.yingxue.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.sql.SQLOutput;
import java.util.Map;


@RestController
@RequestMapping("/admin")
public class AdminController {
    @Autowired
    private AdminService adminService;
    @RequestMapping("/getImageCodes")
    public Map<String,String> getImageCodes() throws IOException {
        return adminService.getImageCodes();
    }
    @PostMapping("/login")
    public Map<String,String> login(@RequestBody Admin admin,String token){
        return adminService.login(admin,token);
    }
    @GetMapping("/getUserInfo")
    public Admin getUserInfo(String token){
        return adminService.getUserInfo(token);
    }
    @PostMapping("/logout")
    void logout(String token){
        System.out.println("================================"+token);
        adminService.logout(token);
    }
}
